/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package migreme;

import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author pavei
 */
public class Item {

   private String title;
   private Integer error;
   private String date;
   private String category;
   private String source;
   private String url;
   private String migre;
   private String id;
   private String errormessage;
   private String created_at;
   private Date createdAt;
   private BigDecimal time;

   

    public Date getCreatedAt() {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date javaDate = null;
      //  System.out.println(created_at);
        try {
             javaDate = format.parse(this.created_at);
        } catch (ParseException ex) {
            Logger.getLogger(Item.class.getName()).log(Level.SEVERE, null, ex);
        }
        createdAt = javaDate;

        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {

        this.createdAt = createdAt;
    }

    public String getErrormessage() {
        return errormessage;
    }

    public void setErrormessage(String errormessage) {
        this.errormessage = errormessage;
    }

   

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public Date getDate() {
         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date javaDate = null;
        //System.out.println(created_at);
        try {
             javaDate = format.parse(this.date);
        } catch (ParseException ex) {
            Logger.getLogger(Item.class.getName()).log(Level.SEVERE, null, ex);
        }
        //createdAt = javaDate;


        return javaDate;
    }

    public void setDate(String date) {
        this.date = date;
    }


    public Integer getError() {
        return error;
    }

    public void setError(Integer error) {
        this.error = error;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getMigre() {
        return migre;
    }

    public void setMigre(String migre) {
        this.migre = migre;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    public String toString() {

        String retorno = "";

        retorno += "Title: "+title +"\n";
        retorno += "Error: "+error+"\n";
        retorno += "Erro Message: "+errormessage+"\n";
        retorno += "Categoria: "+category+"\n";
        retorno += "Source: "+source+"\n";
        retorno += "Url: "+url+"\n";
        retorno += "Migre: "+ migre+"\n";
        retorno += "ID: "+id+"\n";
        retorno += "Created at: "+getCreatedAt()+"\n";
        retorno += "Date: "+getDate()+"\n";
        retorno += "Time: "+time;
        
        return retorno;


    }



   






}
